﻿Imports System.IO
Imports AjaxControlToolkit
Imports System.Web.Services
Imports System.Web.Script.Services
Imports System.Collections.Generic

Public Class _Default1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        
    End Sub

    <WebMethod()> <ScriptMethod()>
    Public Shared Function GetImages() As Slide()
        Dim slidesPictures As New List(Of Slide)()
        Dim picturePath As String = HttpContext.Current.Server.MapPath("~/pictures/")
        If picturePath.EndsWith("\") Then
            picturePath = picturePath.Remove(picturePath.Length - 1)
        End If
        Dim pathUri As New Uri(picturePath, UriKind.Absolute)
        Dim files As String() = Directory.GetFiles(picturePath)
        For Each file As String In files
            Dim filePathUri As New Uri(file, UriKind.Absolute)
            slidesPictures.Add(New Slide() With {.ImagePath = pathUri.MakeRelativeUri(filePathUri).ToString()})
        Next
        Return slidesPictures.ToArray()
    End Function

End Class